import 'dart:convert';
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:leader_doctor_flutter/common/http/api.dart';
import 'package:leader_doctor_flutter/common/http/http_client.dart';
import 'package:leader_doctor_flutter/common/utils/log_utils.dart';
import 'package:leader_doctor_flutter/common/utils/string_utils.dart';
import 'package:leader_doctor_flutter/common/widget/comm_widget.dart';

import '../plugins/plugins_messages.g.dart';

/// @Author lixiaobin
/// @Date 2023/12/11
/// @Description
class FunctionTest extends StatefulWidget {
  const FunctionTest({super.key});

  @override
  State<FunctionTest> createState() => _FunctionTestState();
}

class _FunctionTestState extends State<FunctionTest> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: CommWidget.getCommAppbar(context),
        body: Column(
          children: [
            ElevatedButton(
                child: const Text('银行卡脱敏'),
                onPressed: () {
                  Log.d(StringUtils.formatBankNum("62232772609237809", 4));
                  Log.d(StringUtils.formatBankNum("4682035804103219", 4));
                  Log.d(StringUtils.formatBankNum("6222606937900396933", 4));
                  Log.d(StringUtils.formatBankNum("6223423342711093432", 4));
                }),
            ElevatedButton(
                child: const Text('上传文件'),
                onPressed: () {
                  upFile();
                })
          ],
        ));
  }

  upFile() async {
    // var httpRequest = HttpRequest(Api.fileUpload, files: [
    //   FileInfo(fileName: '123.txt', bytes: [100, 100, 100, 100])
    // ]);
    // var httpResponse = await HttpClient.postFileBytes(httpRequest);
    // if (httpResponse.success) {
    //   print(httpResponse.body);
    // }
  }
}
